﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Automobile.service.Model;
using Automobile.service.BLL;
using System.Data;
namespace Automobile.service.UI.Handler
{
    /// <summary>
    /// product_brand 的摘要说明
    /// </summary>
    public class product_brand : IHttpHandler
    {
        DocumentBLL bll = new DocumentBLL();
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string Product_Name = context.Request["Product_Name"];
            DataTable data = bll.Product_Sel(Product_Name);
            List<Product> list = new List<Product>();
            foreach (DataRow item in data.Rows)
            {
                Product P = new Product();
                P.Product_Id = Convert.ToInt32(item["Product_Id"]);
                P.Product_Barcode = item["Product_Barcode"].ToString();
                P.Product_Bprid = Convert.ToDecimal(item["Product_Bprid"]);
                P.Product_frim = item["Product_frim"].ToString();
                P.Product_Modelspe = item["Product_Modelspe"].ToString();
                P.Product_Name = item["Product_Name"].ToString();
                P.Product_Price = Convert.ToDecimal(item["Product_Price"]);
                P.Product_Remark = item["Product_Remark"].ToString();
                P.Product_Type_Name = item["Product_Type_Name"].ToString();
                P.Product_Unit_Id = item["Product_Unit_Id"].ToString();
                list.Add(P);
            }
            context.Response.Write(new System.Web.Script.Serialization.JavaScriptSerializer { MaxJsonLength = Int32.MaxValue }.Serialize(list));
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}